import fetch from 'common/src/utils/fetch'
import UTILS from "common/src/utils/utils";

function adjustClassNumber(data) {
    return fetch({
        url: `/api/electionservice/elcResult/adjustClassNumber`,
        method: 'post',
        data: data
    });
}
function autoRemove(data) {
    return fetch({
        url: `/api/electionservice/elcResult/autoRemove`,
        method: 'post',
        data: data
    });
}

function autoBatchRemove(data) {
    return fetch({
        url: `/api/electionservice/elcResult/autoBatchRemove`,
        method: 'post',
        data: data
    });
}

function findAutoBatchRemove(key) {
    return fetch({
        url: `/api/electionservice/elcResult/findAutoBatchRemove?key=` + key,
        method: 'get',
    });
}

function setReserveNum(data) {
    return fetch({
        url: `/api/electionservice/elcResult/setReserveNum`,
        method: 'post',
        data: data
    });
}

function batchSetReserveNum(data) {
    return fetch({
        url: `/api/electionservice/elcResult/batchSetReserveNum`,
        method: 'post',
        data: data
    });
}

function setReserveProportion(data) {
    return fetch({
        url: `/api/electionservice/elcResult/setReserveProportion`,
        method: 'post',
        data: data
    });
}

function releaseAll(data) {
    return fetch({
        url: `/api/electionservice/elcResult/releaseAll`,
        method: 'post',
        data: data
    });
}

function saveElcLimit(data){
    return fetch({
        url: `/api/electionservice/elcResult/saveElcLimit`,
        method: 'post',
        data: data
    });
}

// 选课条件设置  来源排课
function getLimitItemById(id) {
    return fetch({
        url: `/api/arrangementservice/teachingTask/getTaskById?id=${id}
            &campus=null`,
        method: 'get'
    });
}

// 选课条件设置  来源选课
function elecLimitQuery(id) {
    return fetch({
        url: `/api/electionservice/elcResult/elecLimitQuery?teachingClassId=${id}`,
        method: 'get'
    });
}
// 选课条件设置 保存
function newSaveElcLimit(id, data) {
    return fetch({
        url: `api/electionservice/elcResult/${id}/class/updateLimit`,
        method: 'post',
        data: data
    });
}

function saveProportion(data) {
    return fetch({
        url: `/api/electionservice/elcResult/saveProportion`,
        method: 'post',
        data: data
    });
}

function saveScreeningLabel(data) {
    return fetch({
        url: `/api/electionservice/elcResult/saveScreeningLabel`,
        method: 'post',
        data: data
    });
}

function maleToFemaleRatio(data) {
    return fetch({
        url: `/api/electionservice/elcResult/maleToFemaleRatio`,
        method: 'post',
        data: data
    });
}

export default {
    "teachClassPageUrl":"/api/electionservice/elcResult/teachClassPage",
    "teachClassNumPageUrl":"/api/electionservice/elcResult/teachClassNumPage",
    "teachClassPageTjUrl":"/api/electionservice/elcResult/teachClassPageTj",
    "cultureStuPageUrl":"/api/cultureservice/studentCultureRel/listPage2Elc",
    "adjustClassNumber": adjustClassNumber,
    "autoRemove": autoRemove,
    "setReserveNum": setReserveNum,
    "batchSetReserveNum": batchSetReserveNum,
    "setReserveProportion": setReserveProportion,
    "releaseAll": releaseAll,
    "saveElcLimit": saveElcLimit,
    "getLimitItemById": getLimitItemById,
    "newSaveElcLimit": newSaveElcLimit,
    "saveProportion": saveProportion,
    "saveScreeningLabel": saveScreeningLabel,
    'autoBatchRemove': autoBatchRemove,
    'findAutoBatchRemove': findAutoBatchRemove,
    'maleToFemaleRatio': maleToFemaleRatio,
    'elecLimitQuery': elecLimitQuery,
    'getWithdrawRulesUrl' : `/api/electionservice/elcCourseTake/practiceList`
}
